package api

import (
	"fmt"

	"github.com/gin-gonic/gin"
)

func RegisterApi(prefix string, router *gin.Engine, jwtHandler gin.HandlerFunc) {
	router.GET(fmt.Sprintf("%s/api/hello", prefix), h2oHello)
	router.GET(fmt.Sprintf("%s/oss/avatar", prefix), jwtHandler, ossAvator)
	router.GET(fmt.Sprintf("%s/oss/get", prefix), ossDownload)
	router.POST(fmt.Sprintf("%s/oss/upload", prefix), jwtHandler, ossUpload)
	apiv1 := router.Group(fmt.Sprintf("%s/api/v1", prefix))
	{
		apiv1.POST("/user/wxlogin", h2oWxLogin)
		apiv1.POST("/user/wxupload-avator", jwtHandler, h2oWxUploadAvator)
		apiv1.POST("/moment/publish", jwtHandler, publishMoment)
		apiv1.POST("/moment/update", jwtHandler, updateMoment)
		apiv1.POST("/aifuns/gen-travel", genTravel)
		apiv1.POST("/aifuns/forword", forward)
		apiv1.POST("/aifuns/call-back", callback)

		apiv1.GET("/moment/recommend", recommendMoment)
		apiv1.GET("/moment/get-single", getMoment)
	}
}
